﻿<ValueConversion(GetType(Double), GetType(Double))>
Public Class MultiplyConverter
    Inherits System.Windows.Markup.MarkupExtension
    Implements IValueConverter
    Public Sub New()
    End Sub
    Public Sub New(nMultiplier As Double)
        _Multiplier = nMultiplier
    End Sub
    Public Property Multiplier As Double
    Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
        If TypeOf value Is Double Then
            Return value * _Multiplier
        Else
            Return value
        End If
    End Function
    Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
        If TypeOf value Is Double Then
            Return value / _Multiplier
        Else
            Return value
        End If
    End Function
    Public Overrides Function ProvideValue(serviceProvider As IServiceProvider) As Object
        Return Me
    End Function
End Class
